home *** CD-ROM | disk | FTP | other *** search
- Program PWord;
- uses dos,crt;
-
- const
- {カラーテーブル設定}
- kuro=0;Ao=1;Midori=2;Mizuiro=3;Aka=4;Kiiro=6;Murasaki=5;Shiro=7;
- var
- jisyo,jisyo_out:text;{印刷するファイル名}
- Eng,
- Jap,OutLine,
- FileLine:string;
- select:char;
-
- {==========此処からは関数, 手続きを書く=================================}
- function B_pos(locate:integer; key,s:string):integer;
- var {s の locate 文字目から key を探してその番号を帰す}
- Dammy:string[255];
- begin
- Dammy:=copy(s,locate,length(s)-locate+1);
- If Pos(key,Dammy)=0 then B_Pos:=0
- else B_Pos:=Pos(key,Dammy)+locate-1;
- end;
-
- {==メモリーが充分かどうかをチェックするルーチン==ここは既に完成==}
- {$f+}
- function HeapFunc(Size: word): integer;
- {$f-}
- begin
- Writeln(^G+'メモリーが足りません');
- HeapFunc := 1;
- end; { HeapErrorFunc }
-
- {=========タイトル表示ルーチン===ここは既に完成==========================}
- procedure Title; {コピーライト表示}
- begin
- clrscr;
- TextColor(Shiro);
- Write(' ---- For All FM-Series');
- Writeln(' 英文翻訳支援プログラムシリーズ ----');
- Write(' --- ');
- TextColor(mizuiro);
- Write('PWORD.EXE Ver.1.02α');
- TextColor(Shiro);
- Writeln(' ---');
- WriteLn(' Programed by H.Nakayasu (c) 1992');
- TextColor(Shiro);
- end;
-
- procedure line;
- var i:integer;
- begin
- textcolor(midori);
- for i:=1 to 80 do
- write('-');
- textcolor(shiro);
- end;
-
- {===編集ファイルの確認(存在を含めて)====完成================================}
- procedure CheckFileExistAndOpenFile;
- procedure CheckFileExistAndOpenFileSub;
- begin
- Textcolor(aka);
- writeln('<使い方>');
- Textcolor(shiro);
- writeln('PWord [ファイル名] ([ファイル名])');
- halt(1);
- end;
- begin
- IF paramcount=0 then CheckFileExistAndOpenFileSub;
- Assign(Jisyo,paramstr(1));
- {$i-} Reset(Jisyo); {$i+}
- if IOResult <> 0 then CheckFileExistAndOpenFileSub;
- end;
-
- begin{メインルーチン}
- {===初期の表示=====完成=====================================}
- HeapError := @HeapFunc;
- CheckFileExistAndOpenFile;
- title;
- line;
-
- {===一行を辞書ファイルより切り取り、単語と訳を印刷する==完成===============}
- IF not(paramstr(2)='') then
- begin
- Assign(Jisyo_out,paramstr(2));
- {$i-} Append(Jisyo_out); {$i+}
- if IOResult=0 then
- begin
- writeln(paramstr(2),'が存在します。上書きしても宜しいですか?');
- writeln('上書きするとファイルの中身は消去されます。[Y/N]');
- repeat
- select:=readkey;
- until select in ['Y','y','N','n'];
- if (select='y')or(select='Y') then rewrite(Jisyo_out)
- else
- begin
- close(JIsyo);
- close(JIsyo_out);
- halt(1);
- end;
- end{end of if}
- else
- begin
- rewrite(Jisyo_out)
- end;
- end;{end of IF}
-
- while not eof(Jisyo) do
- begin
- readln(JIsyo,FileLine);
- Eng:=copy(FileLine,1,B_pos(1,'/',Fileline)-1);
- Jap:=copy(FileLine,B_pos(1,'/',Fileline)+1,Length(FileLine));
- Outline:=eng;
- writeln(eng,' ':20-length(eng),jap);
- IF paramstr(2)<>'' then
- writeln(Jisyo_out,eng,' ':20-length(eng),jap);
- end;
-
- close(Jisyo);
- IF paramstr(2)<>'' then Begin
- flush(Jisyo_out);
- close(Jisyo_out);
- end;
- textcolor(shiro);
- halt(0);
- end.